package packml;



import java.text.*;

public class Clock2 {
     int Hours;
     int Minutes;
     int Seconds;
   
	public Clock2(){
		Hours = 0;
		Minutes = 0;
		Seconds = 0;
	}
	
	
	public Clock2(int Sec){
		if(Sec > 60){
			Hours = 0;
			Minutes = 0;
			while(Sec >= 60){
				increaseMinutes();
				Sec -= 60;
			}
			Seconds = Sec;
		}else{
			Hours = 0;
			Minutes = 0;
			Seconds = Sec;
		}
	}

	
	public String displayTime(){
		
		MessageFormat mf = new MessageFormat("{0}:{1}:{2}");
		DecimalFormat df = new DecimalFormat("00");
		Object[] objs = {df.format(Hours), df.format(Minutes), df.format(Seconds)}; 
		return mf.format(objs);
		
		
	}

	public void increaseSeconds(){
		Seconds++;
		//System.out.println("Seconds........"+Seconds);
		if(Seconds >= 60){
			Seconds = 0;
			increaseMinutes();
		}
	}

	public void increaseMinutes(){
		Minutes++;
		if(Minutes >= 60){
			Minutes = 0;
			increaseHours();
		}
	}

		public void increaseHours(){
		Hours++;
		
		if(Hours >= 99){
			Hours = 0;
		}
	}
	
	 public void resetClock(){
	
		Hours = 0;
		Minutes = 0;
				Seconds = 0;
	
	
	}
}

